﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Entity;
using BAL;
using Common;
using System.Text;
namespace Web
{
    public class SynthesizeHelper
    {
        public static string[] ExamRoomIds;
        public static string ExamRoomId = "";
        public static IList<ExamPaperInfo> ExamPaperInfos;
        public static ExamPaperInfo examPaperInfo = new ExamPaperInfo();
        public static IList<StudentScoreExtendInfo> AllScoreInfos = new List<StudentScoreExtendInfo>();
        public static int AreaId = 0;
        public static int SchoolId = 0;

        #region Header
        //考试科目概况
        public static string ChartHeader0()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>学科</th>");
            sb_Header.Append("<th>单科分数</th>");
            sb_Header.Append("<th>单科分数权重</th>");
            sb_Header.Append("<th>单科测试时间（分钟）</th>");
            sb_Header.Append("<th>单科测试时间权重</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //海淀区学校名单
        public static string ChartHeader1()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>分组</th>");
            sb_Header.Append("<th>编号</th>");
            sb_Header.Append("<th>学校名称</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //总体成绩统计表
        public static string ChartHeader2()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>类别</th>");
            sb_Header.Append("<th colspan='4'>本校</th>");
            sb_Header.Append("<th colspan='4'>本分组</th>");
            sb_Header.Append("<th colspan='4'>海淀区</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>实考人数</th>");
            sb_Header.Append("<th>最高分</th>");
            sb_Header.Append("<th>最低分</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>实考人数</th>");
            sb_Header.Append("<th>最高分</th>");
            sb_Header.Append("<th>最低分</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>实考人数</th>");
            sb_Header.Append("<th>最高分</th>");
            sb_Header.Append("<th>最低分</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //上线分数统计
        public static string ChartHeader3()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>科目</th>");
            sb_Header.Append("<th colspan='4'>四线类别</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>A线（20%）</th>");
            sb_Header.Append("<th>B线（40%）</th>");
            sb_Header.Append("<th>C线（60%）</th>");
            sb_Header.Append("<th>D线（80%）</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //上线人数统计
        public static string ChartHeader4()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>科目</th>");
            sb_Header.Append("<th colspan='2'>A线</th>");
            sb_Header.Append("<th colspan='2'>B线</th>");
            sb_Header.Append("<th colspan='2'>C线</th>");
            sb_Header.Append("<th colspan='2'>D线</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>占全校比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>占全校比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>占全校比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>占全校比例</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //合格率分析
        public static string ChartHeader5()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>科目</th>");
            sb_Header.Append("<th colspan='4'>优秀</th>");
            sb_Header.Append("<th colspan='4'>良好</th>");
            sb_Header.Append("<th colspan='4'>合格</th>");
            sb_Header.Append("<th colspan='4'>不合格</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>平均得分率</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>平均得分率</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>平均得分率</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>平均得分率</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //成绩分布
        public static string ChartHeader6()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>分数段</th>");
            sb_Header.Append("<th colspan='4'>本校</th>");
            sb_Header.Append("<th colspan='4'>本分组</th>");
            sb_Header.Append("<th colspan='4'>海淀区</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>段内人数</th>");
            sb_Header.Append("<th>累计人数</th>");
            sb_Header.Append("<th>段内比例</th>");
            sb_Header.Append("<th>累计比例</th>");
            sb_Header.Append("<th>段内人数</th>");
            sb_Header.Append("<th>累计人数</th>");
            sb_Header.Append("<th>段内比例</th>");
            sb_Header.Append("<th>累计比例</th>");
            sb_Header.Append("<th>段内人数</th>");
            sb_Header.Append("<th>累计人数</th>");
            sb_Header.Append("<th>段内比例</th>");
            sb_Header.Append("<th>累计比例</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //学业综合竞争力分析
        public static string ChartHeader7()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>科目</th>");
            sb_Header.Append("<th colspan='2'>平均得分率</th>");
            sb_Header.Append("<th colspan='2'>A线</th>");
            sb_Header.Append("<th colspan='2'>B线</th>");
            sb_Header.Append("<th colspan='2'>C线</th>");
            sb_Header.Append("<th colspan='2'>D线</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>数值</th>");
            sb_Header.Append("<th>全区位置</th>");
            sb_Header.Append("<th>数值</th>");
            sb_Header.Append("<th>全区位置</th>");
            sb_Header.Append("<th>数值</th>");
            sb_Header.Append("<th>全区位置</th>");
            sb_Header.Append("<th>数值</th>");
            sb_Header.Append("<th>全区位置</th>");
            sb_Header.Append("<th>数值</th>");
            sb_Header.Append("<th>全区位置</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //各班级成绩统计
        public static string ChartHeader8()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>班级</th>");
            sb_Header.Append("<th rowspan='2'>实考人数</th>");
            sb_Header.Append("<th colspan='2'>总分</th>");
            foreach (ExamPaperInfo exampaperInfo in ExamPaperInfos)
            {
                SubjectInfo subjectInfo = Subject.GetSubjectInfoById(exampaperInfo.Subject.Value);
                sb_Header.Append("<th colspan='2'>" + subjectInfo.Name + "</th>");
            }
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>得份率</th>");
            for (int i = 0; i < ExamPaperInfos.Count; i++)
            {
                sb_Header.Append("<th>平均分</th>");
                sb_Header.Append("<th>得份率</th>");
            }
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //各班级上线人数比例统计
        public static string ChartHeader9()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>班级</th>");
            sb_Header.Append("<th rowspan='2'>实考人数</th>");
            sb_Header.Append("<th colspan='2'>A线</th>");
            sb_Header.Append("<th colspan='2'>B线</th>");
            sb_Header.Append("<th colspan='2'>C线</th>");
            sb_Header.Append("<th colspan='2'>D线</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //各班级合格率分析
        public static string ChartHeader10()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>班级</th>");
            sb_Header.Append("<th rowspan='2'>实考人数</th>");
            sb_Header.Append("<th colspan='2'>优秀</th>");
            sb_Header.Append("<th colspan='2'>良好</th>");
            sb_Header.Append("<th colspan='2'>合格</th>");
            sb_Header.Append("<th colspan='2'>不合格</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //不同分组学校水平差异
        public static string ChartHeader11()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>学校分组</th>");
            sb_Header.Append("<th>总平均分</th>");
            sb_Header.Append("<th>总平均分得分率</th>");
            sb_Header.Append("<th>A线比例</th>");
            sb_Header.Append("<th>B线比例</th>");
            sb_Header.Append("<th>C线比例</th>");
            sb_Header.Append("<th>D线比例</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //合格率比较分析表
        public static string ChartHeader12()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>学校分组</th>");
            sb_Header.Append("<th>总平均分</th>");
            sb_Header.Append("<th>总平均得分率</th>");
            sb_Header.Append("<th>优秀率</th>");
            sb_Header.Append("<th>良好率</th>");
            sb_Header.Append("<th>合格率</th>");
            sb_Header.Append("<th>不合格率</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //中考成绩优秀生统计
        public static string ChartHeader13()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>名次</th>");
            sb_Header.Append("<th>姓名</th>");
            sb_Header.Append("<th>所属班级</th>");
            sb_Header.Append("<th>总分</th>");
            foreach (ExamPaperInfo exampaperInfo in ExamPaperInfos)
            {
                SubjectInfo subjectInfo = Subject.GetSubjectInfoById(exampaperInfo.Subject.Value);
                sb_Header.Append("<th>" + subjectInfo.Name + "</th>");
            }
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //单科成绩分析表
        public static string ChartHeader14()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>类别</th>");
            sb_Header.Append("<th>实考人数</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>最高分</th>");
            sb_Header.Append("<th>最低分</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //单科四线成绩分析表
        public static string ChartHeader15()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>类别</th>");
            sb_Header.Append("<th colspan='2'>A线</th>");
            sb_Header.Append("<th colspan='2'>B线</th>");
            sb_Header.Append("<th colspan='2'>C线</th>");
            sb_Header.Append("<th colspan='2'>D线</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("<th>人数</th>");
            sb_Header.Append("<th>比例</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //单科成绩分布情况
        public static string ChartHeader16()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>分数段</th>");
            sb_Header.Append("<th colspan='4'>本校</th>");
            sb_Header.Append("<th colspan='4'>本分组</th>");
            sb_Header.Append("<th colspan='4'>海淀区</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>段内人数</th>");
            sb_Header.Append("<th>累计人数</th>");
            sb_Header.Append("<th>段内比例</th>");
            sb_Header.Append("<th>累计比例</th>");
            sb_Header.Append("<th>段内人数</th>");
            sb_Header.Append("<th>累计人数</th>");
            sb_Header.Append("<th>段内比例</th>");
            sb_Header.Append("<th>累计比例</th>");
            sb_Header.Append("<th>段内人数</th>");
            sb_Header.Append("<th>累计人数</th>");
            sb_Header.Append("<th>段内比例</th>");
            sb_Header.Append("<th>累计比例</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        //单科合格率分析表
        public static string ChartHeader17()
        {
            StringBuilder sb_Header = new StringBuilder();
            sb_Header.Append("<tr>");
            sb_Header.Append("<th rowspan='2'>类别</th>");
            sb_Header.Append("<th colspan='3'>总体</th>");
            sb_Header.Append("<th colspan='2'>优秀</th>");
            sb_Header.Append("<th colspan='2'>良好</th>");
            sb_Header.Append("<th colspan='2'>合格</th>");
            sb_Header.Append("<th colspan='2'>不合格</th>");
            sb_Header.Append("</tr>");
            sb_Header.Append("<tr>");
            sb_Header.Append("<th>实考人数</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>平均得分率</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>平均得分率</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>平均得分率</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>平均得分率</th>");
            sb_Header.Append("<th>平均分</th>");
            sb_Header.Append("<th>平均得分率</th>");
            sb_Header.Append("</tr>");
            return sb_Header.ToString();
        }
        #endregion

        #region Body
        public static string ChartBody0()
        {
            StringBuilder sb_Body = new StringBuilder();

            int ScoreCount = ExamPaperInfos.Sum(t => t.Score.Value);
            int TimeCount = ExamPaperInfos.Sum(t => t.TimeLong.Value);
            foreach (ExamPaperInfo examPaperInfo in ExamPaperInfos)
            {
                SubjectInfo subjectInfo = Subject.GetSubjectInfoById(examPaperInfo.Subject.Value);
                decimal scorePercent = Math.Round((decimal)examPaperInfo.Score.Value / (decimal)ScoreCount * 100, 2);
                decimal timePercent = Math.Round((decimal)examPaperInfo.TimeLong.Value / (decimal)TimeCount * 100, 2);
                sb_Body.Append("<tr>");
                sb_Body.Append("<td>" + subjectInfo.Name + "</td>");
                sb_Body.Append("<td>" + examPaperInfo.Score + "</td>");
                sb_Body.Append("<td>" + scorePercent + "%</td>");
                sb_Body.Append("<td>" + examPaperInfo.TimeLong + "</td>");
                sb_Body.Append("<td>" + timePercent + "%</td>");
                sb_Body.Append("</tr>");
            }
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>总计</td>");
            sb_Body.Append("<td>" + ScoreCount + "</td>");
            sb_Body.Append("<td>100%</td>");
            sb_Body.Append("<td>" + TimeCount + "</td>");
            sb_Body.Append("<td>100%</td>");
            sb_Body.Append("</tr>");
            return sb_Body.ToString();
        }

        public static string ChartBody1()
        {
            StringBuilder sb_Body = new StringBuilder();
            IList<SchoolInfo> schoolInfos = School.GetSchoolInfoByAreaId(AreaId);
            AreaInfo areaInfo = Area.GetSingleInfo(AreaId);
            int i = 0;
            foreach (SchoolInfo schoolInfo in schoolInfos)
            {
                sb_Body.Append("<tr>");
                if (i == 0)
                {
                    sb_Body.Append("<td rowspan='" + schoolInfos.Count + "'>" + areaInfo.Name + "</td>");
                }
                sb_Body.Append("<td>" + schoolInfo.Id + "</td>");
                sb_Body.Append("<td>" + schoolInfo.Name + "</td>");
                sb_Body.Append("</tr>");
                i++;
            }
            return sb_Body.ToString();
        }

        public static string ChartBody2()
        {
            StringBuilder sb_Body = new StringBuilder();

            IList<StudentScoreExtendInfo> SchoolScoreInfos = AllScoreInfos.Where(t => t.SchoolId == SchoolId).ToList();
            IList<StudentScoreExtendInfo> AreaScoreInfos = AllScoreInfos.Where(t => t.AreaId == AreaId).ToList();
            try
            {
                foreach (ExamPaperInfo examPaperInfo in ExamPaperInfos)
                {
                    IList<StudentScoreExtendInfo> subject_SchoolScoreInfos = SchoolScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).ToList();
                    IList<StudentScoreExtendInfo> subject_AreaScoreInfos = AreaScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).ToList();
                    IList<StudentScoreExtendInfo> subject_AllScoreInfos = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).ToList();
                    sb_Body.Append("<tr>");
                    SubjectInfo subjectInfo = Subject.GetSubjectInfoById(examPaperInfo.Subject.Value);
                    sb_Body.Append("<td>" + subjectInfo.Name + "</td>");
                    sb_Body.Append("<td>" + subject_SchoolScoreInfos.Count() + "</td>");
                    sb_Body.Append("<td>" + subject_SchoolScoreInfos.Max(t => t.CountScore) + "</td>");
                    sb_Body.Append("<td>" + subject_SchoolScoreInfos.Min(t => t.CountScore) + "</td>");
                    sb_Body.Append("<td>" + Math.Round(subject_SchoolScoreInfos.Sum(t => t.CountScore) / subject_SchoolScoreInfos.Count(), 2) + "</td>");

                    sb_Body.Append("<td>" + subject_AreaScoreInfos.Count() + "</td>");
                    sb_Body.Append("<td>" + subject_AreaScoreInfos.Max(t => t.CountScore) + "</td>");
                    sb_Body.Append("<td>" + subject_AreaScoreInfos.Min(t => t.CountScore) + "</td>");
                    sb_Body.Append("<td>" + Math.Round(subject_AreaScoreInfos.Sum(t => t.CountScore) / subject_AreaScoreInfos.Count(), 2) + "</td>");

                    sb_Body.Append("<td>" + subject_AllScoreInfos.Count() + "</td>");
                    sb_Body.Append("<td>" + subject_AllScoreInfos.Max(t => t.CountScore) + "</td>");
                    sb_Body.Append("<td>" + subject_AllScoreInfos.Min(t => t.CountScore) + "</td>");
                    sb_Body.Append("<td>" + Math.Round(subject_AllScoreInfos.Sum(t => t.CountScore) / subject_AllScoreInfos.Count(), 2) + "</td>");
                    sb_Body.Append("</tr>");
                }
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
            return sb_Body.ToString();
        }

        public static string ChartBody3()
        {
            StringBuilder sb_Body = new StringBuilder();

            foreach (ExamPaperInfo examPaperInfo in ExamPaperInfos)
            {
                SubjectInfo subjectInfo = Subject.GetSubjectInfoById(examPaperInfo.Subject.Value);
                IList<StudentScoreExtendInfo> scoreInfos = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).OrderByDescending(t => t.CountScore).ToList();
                decimal a = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.2)].CountScore;
                decimal b = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.4)].CountScore;
                decimal c = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.6)].CountScore;
                decimal d = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.8)].CountScore;
                sb_Body.Append("<tr>");
                sb_Body.Append("<td>" + subjectInfo.Name + "</td>");
                sb_Body.Append("<td>" + a + "</td>");
                sb_Body.Append("<td>" + b + "</td>");
                sb_Body.Append("<td>" + c + "</td>");
                sb_Body.Append("<td>" + d + "</td>");
                sb_Body.Append("</tr>");
            }
            var query = AllScoreInfos.GroupBy(t => t.StudentId).Select(c => new { StudentId = c.Key, CountScore = c.Sum(t => t.CountScore) }).OrderByDescending(g => g.CountScore).ToList();
            decimal a_all = query[Convert.ToInt32(query.Count() * 0.2)].CountScore;
            decimal b_all = query[Convert.ToInt32(query.Count() * 0.4)].CountScore;
            decimal c_all = query[Convert.ToInt32(query.Count() * 0.6)].CountScore;
            decimal d_all = query[Convert.ToInt32(query.Count() * 0.8)].CountScore;
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>总分</td>");
            sb_Body.Append("<td>" + a_all + "</td>");
            sb_Body.Append("<td>" + b_all + "</td>");
            sb_Body.Append("<td>" + c_all + "</td>");
            sb_Body.Append("<td>" + d_all + "</td>");
            sb_Body.Append("</tr>");
            return sb_Body.ToString();
        }

        public static string ChartBody4()
        {
            StringBuilder sb_Body = new StringBuilder();
            int SchoolCount = AllScoreInfos.Where(t => t.SchoolId == SchoolId).GroupBy(t => t.StudentId).Count();
            foreach (ExamPaperInfo examPaperInfo in ExamPaperInfos)
            {
                SubjectInfo subjectInfo = Subject.GetSubjectInfoById(examPaperInfo.Subject.Value);
                IList<StudentScoreExtendInfo> scoreInfos = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).OrderByDescending(t => t.CountScore).ToList();
                decimal a = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.2)].CountScore;
                decimal b = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.4)].CountScore;
                decimal c = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.6)].CountScore;
                decimal d = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.8)].CountScore;

                sb_Body.Append("<tr>");
                sb_Body.Append("<td>" + subjectInfo.Name + "</td>");
                sb_Body.Append("<td>" + scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= a).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= a).Count() / SchoolCount * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= b).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= b).Count() / SchoolCount * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= c).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= c).Count() / SchoolCount * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= d).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= d).Count() / SchoolCount * 100, 2) + "%</td>");
                sb_Body.Append("</tr>");
            }
            var query = AllScoreInfos.GroupBy(t => t.StudentId).Select(c => new { StudentId = c.Key, CountScore = c.Sum(t => t.CountScore) }).OrderByDescending(g => g.CountScore).ToList();
            decimal a_all = query[Convert.ToInt32(query.Count() * 0.2)].CountScore;
            decimal b_all = query[Convert.ToInt32(query.Count() * 0.4)].CountScore;
            decimal c_all = query[Convert.ToInt32(query.Count() * 0.6)].CountScore;
            decimal d_all = query[Convert.ToInt32(query.Count() * 0.8)].CountScore;

            var schoolScore = AllScoreInfos.Where(t => t.SchoolId == SchoolId).GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
            int a_schoolcount = schoolScore.Where(t => t.CountScore >= a_all).Count();
            int b_schoolcount = schoolScore.Where(t => t.CountScore >= b_all).Count();
            int c_schoolcount = schoolScore.Where(t => t.CountScore >= c_all).Count();
            int d_schoolcount = schoolScore.Where(t => t.CountScore >= d_all).Count();

            sb_Body.Append("<tr>");
            sb_Body.Append("<td>总分</td>");
            sb_Body.Append("<td>" + a_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)a_schoolcount / SchoolCount * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + b_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)b_schoolcount / SchoolCount * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + c_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)c_schoolcount / SchoolCount * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + d_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)d_schoolcount / SchoolCount * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");
            return sb_Body.ToString();
        }

        public static string ChartBody5()
        {
            StringBuilder sb_Body = new StringBuilder();
            foreach (ExamPaperInfo examPaperInfo in ExamPaperInfos)
            {
                decimal g = Convert.ToDecimal(examPaperInfo.Score.Value * 0.85);
                decimal m = Convert.ToDecimal(examPaperInfo.Score.Value * 0.75);
                decimal l = Convert.ToDecimal(examPaperInfo.Score.Value * 0.6);
                SubjectInfo subjectInfo = Subject.GetSubjectInfoById(examPaperInfo.Subject.Value);
                IList<StudentScoreExtendInfo> scoreInfos = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value && t.SchoolId == SchoolId).OrderByDescending(t => t.CountScore).ToList();
                sb_Body.Append("<tr>");
                sb_Body.Append("<td>" + subjectInfo.Name + "</td>");
                sb_Body.Append("<td>" + scoreInfos.Where(t => t.CountScore >= g).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.CountScore >= g).Count() / scoreInfos.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round(scoreInfos.Where(t => t.CountScore >= g).Sum(t => t.CountScore) / scoreInfos.Where(t => t.CountScore >= g).Count(), 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(scoreInfos.Where(t => t.CountScore >= g).Sum(t => t.CountScore) / (scoreInfos.Where(t => t.CountScore >= g).Count() * examPaperInfo.Score.Value) * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + scoreInfos.Where(t => t.CountScore < g && t.CountScore >= m).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.CountScore < g && t.CountScore >= m).Count() / scoreInfos.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round(scoreInfos.Where(t => t.CountScore < g && t.CountScore >= m).Sum(t => t.CountScore) / scoreInfos.Where(t => t.CountScore < g && t.CountScore >= m).Count(), 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(scoreInfos.Where(t => t.CountScore < g && t.CountScore >= m).Sum(t => t.CountScore) / (scoreInfos.Where(t => t.CountScore < g && t.CountScore >= m).Count() * examPaperInfo.Score.Value) * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + scoreInfos.Where(t => t.CountScore < m && t.CountScore >= l).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.CountScore < m && t.CountScore >= l).Count() / scoreInfos.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round(scoreInfos.Where(t => t.CountScore < m && t.CountScore >= l).Sum(t => t.CountScore) / scoreInfos.Where(t => t.CountScore < m && t.CountScore >= l).Count(), 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(scoreInfos.Where(t => t.CountScore < m && t.CountScore >= l).Sum(t => t.CountScore) / (scoreInfos.Where(t => t.CountScore < m && t.CountScore >= l).Count() * examPaperInfo.Score.Value) * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + scoreInfos.Where(t => t.CountScore < l).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.CountScore < l).Count() / scoreInfos.Count * 100, 2) + "%</td>");
                if (scoreInfos.Where(t => t.CountScore < l).Count() == 0)
                {
                    sb_Body.Append("<td>0</td>");
                    sb_Body.Append("<td>0%</td>");
                }
                else
                {
                    sb_Body.Append("<td>" + Math.Round(scoreInfos.Where(t => t.CountScore < l).Sum(t => t.CountScore) / scoreInfos.Where(t => t.CountScore < l).Count(), 2) + "</td>");

                    sb_Body.Append("<td>" + Math.Round(scoreInfos.Where(t => t.CountScore < l).Sum(t => t.CountScore) / (scoreInfos.Where(t => t.CountScore < l).Count() * examPaperInfo.Score.Value) * 100, 2) + "%</td>");
                }
                sb_Body.Append("</tr>");
            }
            decimal g_all = Convert.ToDecimal(ExamPaperInfos.Sum(t => t.Score.Value) * 0.85);
            decimal m_all = Convert.ToDecimal(ExamPaperInfos.Sum(t => t.Score.Value) * 0.75);
            decimal l_all = Convert.ToDecimal(ExamPaperInfos.Sum(t => t.Score.Value) * 0.6);
            var query = AllScoreInfos.Where(t => t.SchoolId == SchoolId).GroupBy(t => t.StudentId).Select(c => new { StudentId = c.Key, CountScore = c.Sum(t => t.CountScore) }).OrderByDescending(g => g.CountScore).ToList();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>总分</td>");
            sb_Body.Append("<td>" + query.Where(t => t.CountScore >= g_all).Count() + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)query.Where(t => t.CountScore >= g_all).Count() / query.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round(query.Where(t => t.CountScore >= g_all).Sum(t => t.CountScore) / query.Where(t => t.CountScore >= g_all).Count()) + "</td>");
            sb_Body.Append("<td>" + Math.Round(query.Where(t => t.CountScore >= g_all).Sum(t => t.CountScore) / (query.Where(t => t.CountScore >= g_all).Count() * ExamPaperInfos.Sum(t => t.Score.Value)) * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + query.Where(t => t.CountScore < g_all && t.CountScore >= m_all).Count() + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)query.Where(t => t.CountScore < g_all && t.CountScore >= m_all).Count() / query.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round(query.Where(t => t.CountScore < g_all && t.CountScore >= m_all).Sum(t => t.CountScore) / query.Where(t => t.CountScore < g_all && t.CountScore >= m_all).Count()) + "</td>");
            sb_Body.Append("<td>" + Math.Round(query.Where(t => t.CountScore < g_all && t.CountScore >= m_all).Sum(t => t.CountScore) / (query.Where(t => t.CountScore < g_all && t.CountScore >= m_all).Count() * ExamPaperInfos.Sum(t => t.Score.Value)) * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + query.Where(t => t.CountScore < m_all && t.CountScore >= l_all).Count() + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)query.Where(t => t.CountScore < m_all && t.CountScore >= l_all).Count() / query.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round(query.Where(t => t.CountScore < m_all && t.CountScore >= l_all).Sum(t => t.CountScore) / query.Where(t => t.CountScore < m_all && t.CountScore >= l_all).Count()) + "</td>");
            sb_Body.Append("<td>" + Math.Round(query.Where(t => t.CountScore < m_all && t.CountScore >= l_all).Sum(t => t.CountScore) / (query.Where(t => t.CountScore < m_all && t.CountScore >= l_all).Count() * ExamPaperInfos.Sum(t => t.Score.Value)) * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + query.Where(t => t.CountScore < l_all).Count() + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)query.Where(t => t.CountScore < l_all).Count() / query.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round(query.Where(t => t.CountScore < l_all).Sum(t => t.CountScore) / query.Where(t => t.CountScore < l_all).Count()) + "</td>");
            sb_Body.Append("<td>" + Math.Round(query.Where(t => t.CountScore < l_all).Sum(t => t.CountScore) / (query.Where(t => t.CountScore < l_all).Count() * ExamPaperInfos.Sum(t => t.Score.Value)) * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");
            return sb_Body.ToString();
        }

        public static string ChartBody6()
        {
            StringBuilder sb_Body = new StringBuilder();
            var query = AllScoreInfos.Where(t => t.SchoolId == SchoolId).GroupBy(t => t.StudentId).Select(c => new { StudentId = c.Key, CountScore = c.Sum(t => t.CountScore) }).OrderByDescending(g => g.CountScore).ToList();
            var query1 = AllScoreInfos.Where(t => t.AreaId == AreaId).GroupBy(t => t.StudentId).Select(c => new { StudentId = c.Key, CountScore = c.Sum(t => t.CountScore) }).OrderByDescending(g => g.CountScore).ToList();
            var query2 = AllScoreInfos.GroupBy(t => t.StudentId).Select(c => new { StudentId = c.Key, CountScore = c.Sum(t => t.CountScore) }).OrderByDescending(g => g.CountScore).ToList();
            int i = 540;
            while (i > 270)
            {
                sb_Body.Append("<tr>");
                sb_Body.Append("<td>" + i + "~" + (i - 5) + "</td>");
                sb_Body.Append("<td>" + query.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + query.Where(t => t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)query.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() / query.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)query.Where(t => t.CountScore >= i - 5).Count() / query.Count * 100, 2) + "%</td>");

                sb_Body.Append("<td>" + query1.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + query1.Where(t => t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)query1.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() / query1.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)query1.Where(t => t.CountScore >= i - 5).Count() / query1.Count * 100, 2) + "%</td>");

                sb_Body.Append("<td>" + query2.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + query2.Where(t => t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)query2.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() / query2.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)query2.Where(t => t.CountScore >= i - 5).Count() / query2.Count * 100, 2) + "%</td>");
                sb_Body.Append("<tr>");
                i = i - 5;
            }
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>" + i + "以下</td>");
            sb_Body.Append("<td>" + query.Where(t => t.CountScore < i).Count() + "</td>");
            sb_Body.Append("<td>" + query.Count() + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)query.Where(t => t.CountScore < i).Count() / query.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)query.Count() / query.Count * 100, 2) + "%</td>");

            sb_Body.Append("<td>" + query1.Where(t => t.CountScore < i).Count() + "</td>");
            sb_Body.Append("<td>" + query1.Count() + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)query1.Where(t => t.CountScore < i).Count() / query1.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)query1.Count() / query1.Count * 100, 2) + "%</td>");

            sb_Body.Append("<td>" + query2.Where(t => t.CountScore < i).Count() + "</td>");
            sb_Body.Append("<td>" + query2.Count() + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)query2.Where(t => t.CountScore < i).Count() / query2.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)query2.Count() / query2.Count * 100, 2) + "%</td>");
            sb_Body.Append("<tr>");
            return sb_Body.ToString();
        }

        public static string ChartBody7()
        {
            StringBuilder sb_Body = new StringBuilder();

            foreach (ExamPaperInfo examPaperInfo in ExamPaperInfos)
            {

                SubjectInfo subjectInfo = Subject.GetSubjectInfoById(examPaperInfo.Subject.Value);
                IList<StudentScoreExtendInfo> scoreInfos = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).OrderByDescending(t => t.CountScore).ToList();
                decimal a = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.2)].CountScore;
                decimal b = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.4)].CountScore;
                decimal c = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.6)].CountScore;
                decimal d = scoreInfos[Convert.ToInt32(scoreInfos.Count * 0.8)].CountScore;


                var query = scoreInfos.GroupBy(t => t.SchoolId).Select(m => new { SchoolId = m.Key, CountScore = m.Sum(t => t.CountScore) / (m.Count() * examPaperInfo.Score.Value) * 100 }).OrderByDescending(m => m.CountScore).ToList();
                decimal averay = 0;
                int i = 1;
                foreach (var q in query)
                {
                    if (q.SchoolId == SchoolId)
                    {
                        averay = Math.Round(q.CountScore, 2);
                        break;
                    }
                    i++;
                }
                decimal local = Math.Round((decimal)i / query.Count * 100, 2);
                sb_Body.Append("<tr>");
                sb_Body.Append("<td>" + subjectInfo.Name + "</td>");
                sb_Body.Append("<td>" + averay + "%</td>");
                sb_Body.Append("<td>" + local + "%</td>");

                int SchoolCount = scoreInfos.Where(t => t.SchoolId == SchoolId).Count();
                //A线
                var query1 = scoreInfos.Where(t => t.CountScore >= a).GroupBy(t => t.SchoolId).Select(m => new { SchoolId = m.Key, Number = m.Count() }).OrderByDescending(m => m.Number).ToList();
                int j = 1;
                decimal a_local = 0;
                foreach (var q in query1)
                {
                    if (q.SchoolId == SchoolId)
                    {
                        a_local = Math.Round((decimal)j / query.Count * 100, 2);
                        break;
                    }
                    j++;
                }
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= a).Count() / SchoolCount * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + a_local + "%</td>");

                //B线
                var query4 = scoreInfos.Where(t => t.CountScore >= b).GroupBy(t => t.SchoolId).Select(m => new { SchoolId = m.Key, CountScore = m.Count() }).OrderByDescending(m => m.CountScore).ToList();
                int p = 1;
                decimal b_local = 0;
                foreach (var q in query4)
                {
                    if (q.SchoolId == SchoolId)
                    {
                        b_local = Math.Round((decimal)p / query.Count * 100, 2);
                        break;
                    }
                    p++;
                }
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= b).Count() / SchoolCount * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + b_local + "%</td>");

                //C线
                var query2 = scoreInfos.Where(t => t.CountScore >= c).GroupBy(t => t.SchoolId).Select(m => new { SchoolId = m.Key, CountScore = m.Count() }).OrderByDescending(m => m.CountScore).ToList();
                int k = 1;
                decimal c_local = 0;
                foreach (var q in query2)
                {
                    if (q.SchoolId == SchoolId)
                    {
                        c_local = Math.Round((decimal)k / query.Count * 100, 2);
                        break;
                    }
                    k++;
                }
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= c).Count() / SchoolCount * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + c_local + "%</td>");
                //D线
                var query3 = scoreInfos.Where(t => t.CountScore >= d).GroupBy(t => t.SchoolId).Select(m => new { SchoolId = m.Key, CountScore = m.Count() }).OrderByDescending(m => m.CountScore).ToList();
                int o = 1;
                decimal d_local = 0;
                foreach (var q in query3)
                {
                    if (q.SchoolId == SchoolId)
                    {
                        d_local = Math.Round((decimal)o / query.Count * 100, 2);
                        break;
                    }
                    o++;
                }
                sb_Body.Append("<td>" + Math.Round((decimal)scoreInfos.Where(t => t.SchoolId == SchoolId && t.CountScore >= d).Count() / SchoolCount * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + d_local + "%</td>");
                sb_Body.Append("</tr>");
            }
            return sb_Body.ToString();
        }

        public static string ChartBody8()
        {
            StringBuilder sb_Body = new StringBuilder();
            IList<StudentScoreExtendInfo> scoreInfos = AllScoreInfos.Where(t => t.SchoolId == SchoolId).ToList();
            IList<GradeInfo> gradeInfos = Grade.GetGradeInfoBySchoolId(SchoolId);
            foreach (GradeInfo gradeInfo in gradeInfos)
            {
                IList<TClassInfo> classInfos = TClass.GetClassInfoByGradeId(gradeInfo.Id);
                foreach (TClassInfo classInfo in classInfos)
                {
                    sb_Body.Append("<tr>");
                    sb_Body.Append("<td>" + classInfo.Name + "</td>");
                    decimal classCount = scoreInfos.Where(t => t.ClassId == classInfo.Id).Sum(t => t.CountScore);
                    decimal classNum = scoreInfos.Where(t => t.ClassId == classInfo.Id).GroupBy(t => t.StudentId).Count();
                    sb_Body.Append("<td>" + classNum + "</td>");
                    sb_Body.Append("<td>" + Math.Round(classCount / classNum) + "</td>");
                    sb_Body.Append("<td>" + Math.Round(classCount / (ExamPaperInfos.Sum(t => t.Score.Value) * classNum) * 100, 2) + "%</td>");
                    foreach (ExamPaperInfo exampaperInfo in ExamPaperInfos)
                    {
                        decimal subjectScore = scoreInfos.Where(t => t.ClassId == classInfo.Id && t.SubjectId == exampaperInfo.Subject.Value).Sum(t => t.CountScore);
                        sb_Body.Append("<td>" + Math.Round(subjectScore / classNum, 2) + "</td>");
                        sb_Body.Append("<td>" + Math.Round(subjectScore / (exampaperInfo.Score.Value * classNum) * 100, 2) + "%</td>");
                    }
                    sb_Body.Append("</tr>");
                }
            }
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本校</td>");
            decimal schoolCount = scoreInfos.Sum(t => t.CountScore);
            decimal schoolNum = scoreInfos.GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + schoolNum + "</td>");
            sb_Body.Append("<td>" + Math.Round(schoolCount / schoolNum, 2) + "</td>");
            sb_Body.Append("<td>" + Math.Round(schoolCount / (ExamPaperInfos.Sum(t => t.Score.Value) * schoolNum) * 100, 2) + "%</td>");
            foreach (ExamPaperInfo exampaperInfo in ExamPaperInfos)
            {
                decimal schoolsubjectscore = scoreInfos.Where(t => t.SubjectId == exampaperInfo.Subject.Value).Sum(t => t.CountScore);
                sb_Body.Append("<td>" + Math.Round(schoolsubjectscore / schoolNum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(schoolsubjectscore / (exampaperInfo.Score.Value * schoolNum) * 100, 2) + "%</td>");
            }
            sb_Body.Append("</tr>");

            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本分组</td>");
            decimal areaCount = AllScoreInfos.Where(t => t.AreaId == AreaId).Sum(t => t.CountScore);
            decimal areaNum = AllScoreInfos.Where(t => t.AreaId == AreaId).GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + areaNum + "</td>");
            sb_Body.Append("<td>" + Math.Round(areaCount / areaNum, 2) + "</td>");
            sb_Body.Append("<td>" + Math.Round(areaCount / (ExamPaperInfos.Sum(t => t.Score.Value) * areaNum) * 100, 2) + "%</td>");
            foreach (ExamPaperInfo exampaperInfo in ExamPaperInfos)
            {
                decimal areasubjectscore = AllScoreInfos.Where(t => t.AreaId == AreaId && t.SubjectId == exampaperInfo.Subject.Value).Sum(t => t.CountScore);
                sb_Body.Append("<td>" + Math.Round(areasubjectscore / areaNum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(areasubjectscore / (exampaperInfo.Score.Value * areaNum) * 100, 2) + "%</td>");
            }
            sb_Body.Append("</tr>");

            sb_Body.Append("<tr>");
            sb_Body.Append("<td>海淀区</td>");
            decimal allCount = AllScoreInfos.Sum(t => t.CountScore);
            decimal allNum = AllScoreInfos.GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + allNum + "</td>");
            sb_Body.Append("<td>" + Math.Round(allCount / allNum, 2) + "</td>");
            sb_Body.Append("<td>" + Math.Round(allCount / (ExamPaperInfos.Sum(t => t.Score.Value) * allNum) * 100, 2) + "%</td>");
            foreach (ExamPaperInfo exampaperInfo in ExamPaperInfos)
            {
                decimal allsubjectscore = AllScoreInfos.Where(t => t.SubjectId == exampaperInfo.Subject.Value).Sum(t => t.CountScore);
                sb_Body.Append("<td>" + Math.Round(allsubjectscore / allNum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(allsubjectscore / (exampaperInfo.Score.Value * allNum) * 100, 2) + "%</td>");
            }
            sb_Body.Append("</tr>");
            return sb_Body.ToString();
        }

        public static string ChartBody9()
        {
            StringBuilder sb_Body = new StringBuilder();
            IList<StudentScoreExtendInfo> scoreInfos = AllScoreInfos.Where(t => t.SchoolId == SchoolId).ToList();
            IList<GradeInfo> gradeInfos = Grade.GetGradeInfoBySchoolId(SchoolId);

            var query = AllScoreInfos.GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).OrderByDescending(t => t.CountScore).ToList();
            decimal a = query[Convert.ToInt32(query.Count * 0.2)].CountScore;
            decimal b = query[Convert.ToInt32(query.Count * 0.4)].CountScore;
            decimal c = query[Convert.ToInt32(query.Count * 0.6)].CountScore;
            decimal d = query[Convert.ToInt32(query.Count * 0.8)].CountScore;


            foreach (GradeInfo gradeInfo in gradeInfos)
            {
                IList<TClassInfo> classInfos = TClass.GetClassInfoByGradeId(gradeInfo.Id);
                foreach (TClassInfo classInfo in classInfos)
                {
                    sb_Body.Append("<tr>");
                    sb_Body.Append("<td>" + classInfo.Name + "</td>");
                    decimal classNum = scoreInfos.Where(t => t.ClassId == classInfo.Id).GroupBy(t => t.StudentId).Count();
                    sb_Body.Append("<td>" + classNum + "</td>");

                    var classScore = scoreInfos.Where(t => t.ClassId == classInfo.Id).GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
                    int a_count = classScore.Where(m => m.CountScore >= a).Count();
                    int b_count = classScore.Where(m => m.CountScore >= b).Count();
                    int c_count = classScore.Where(m => m.CountScore >= c).Count();
                    int d_count = classScore.Where(m => m.CountScore >= d).Count();
                    sb_Body.Append("<td>" + a_count + "</td>");
                    sb_Body.Append("<td>" + Math.Round(a_count / classNum * 100, 2) + "%</td>");
                    sb_Body.Append("<td>" + b_count + "</td>");
                    sb_Body.Append("<td>" + Math.Round(b_count / classNum * 100, 2) + "%</td>");
                    sb_Body.Append("<td>" + c_count + "</td>");
                    sb_Body.Append("<td>" + Math.Round(c_count / classNum * 100, 2) + "%</td>");
                    sb_Body.Append("<td>" + d_count + "</td>");
                    sb_Body.Append("<td>" + Math.Round(d_count / classNum * 100, 2) + "%</td>");
                    sb_Body.Append("</tr>");
                }
            }

            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本校</td>");
            decimal schoolNum = scoreInfos.GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + schoolNum + "</td>");
            var schoolScore = scoreInfos.GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountSocre = m.Sum(t => t.CountScore) }).ToList();
            int a_schoolcount = schoolScore.Where(t => t.CountSocre >= a).Count();
            int b_schoolcount = schoolScore.Where(t => t.CountSocre >= b).Count();
            int c_schoolcount = schoolScore.Where(t => t.CountSocre >= c).Count();
            int d_schoolcount = schoolScore.Where(t => t.CountSocre >= d).Count();
            sb_Body.Append("<td>" + a_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round(a_schoolcount / schoolNum * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + b_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round(b_schoolcount / schoolNum * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + c_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round(c_schoolcount / schoolNum * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + d_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round(d_schoolcount / schoolNum * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");

            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本分组</td>");
            decimal areaNum = AllScoreInfos.Where(t => t.AreaId == AreaId).GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + areaNum + "</td>");
            var areaScore = AllScoreInfos.Where(t => t.AreaId == AreaId).GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
            int a_areacount = areaScore.Where(m => m.CountScore >= a).Count();
            int b_areacount = areaScore.Where(m => m.CountScore >= b).Count();
            int c_areacount = areaScore.Where(m => m.CountScore >= c).Count();
            int d_areacount = areaScore.Where(m => m.CountScore >= d).Count();
            sb_Body.Append("<td>" + a_areacount + "</td>");
            sb_Body.Append("<td>" + Math.Round(a_areacount / areaNum * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + b_areacount + "</td>");
            sb_Body.Append("<td>" + Math.Round(b_areacount / areaNum * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + c_areacount + "</td>");
            sb_Body.Append("<td>" + Math.Round(c_areacount / areaNum * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + d_areacount + "</td>");
            sb_Body.Append("<td>" + Math.Round(d_areacount / areaNum * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");

            sb_Body.Append("<tr>");
            sb_Body.Append("<td>海淀区</td>");
            decimal allNum = AllScoreInfos.GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + allNum + "</td>");
            int a_allcount = query.Where(m => m.CountScore >= a).Count();
            int b_allcount = query.Where(m => m.CountScore >= b).Count();
            int c_allcount = query.Where(m => m.CountScore >= c).Count();
            int d_allcount = query.Where(m => m.CountScore >= d).Count();
            sb_Body.Append("<td>" + a_allcount + "</td>");
            sb_Body.Append("<td>" + Math.Round(a_allcount / allNum * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + b_allcount + "</td>");
            sb_Body.Append("<td>" + Math.Round(b_allcount / allNum * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + c_allcount + "</td>");
            sb_Body.Append("<td>" + Math.Round(c_allcount / allNum * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + d_allcount + "</td>");
            sb_Body.Append("<td>" + Math.Round(d_allcount / allNum * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");
            return sb_Body.ToString();
        }

        public static string ChartBody10()
        {
            StringBuilder sb_Body = new StringBuilder();
            IList<StudentScoreExtendInfo> scoreInfos = AllScoreInfos.Where(t => t.SchoolId == SchoolId).ToList();
            IList<GradeInfo> gradeInfos = Grade.GetGradeInfoBySchoolId(SchoolId);

            decimal g_all = Convert.ToDecimal(ExamPaperInfos.Sum(t => t.Score.Value) * 0.85);
            decimal m_all = Convert.ToDecimal(ExamPaperInfos.Sum(t => t.Score.Value) * 0.75);
            decimal l_all = Convert.ToDecimal(ExamPaperInfos.Sum(t => t.Score.Value) * 0.6);

            foreach (GradeInfo gradeInfo in gradeInfos)
            {
                IList<TClassInfo> classInfos = TClass.GetClassInfoByGradeId(gradeInfo.Id);
                foreach (TClassInfo classInfo in classInfos)
                {
                    sb_Body.Append("<tr>");
                    sb_Body.Append("<td>" + classInfo.Name + "</td>");
                    decimal classNum = scoreInfos.Where(t => t.ClassId == classInfo.Id).GroupBy(t => t.StudentId).Count();
                    sb_Body.Append("<td>" + classNum + "</td>");

                    var classsScore = scoreInfos.Where(t => t.ClassId == classInfo.Id).GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
                    int g_count = classsScore.Where(t => t.CountScore >= g_all).Count();
                    int m_count = classsScore.Where(t => t.CountScore >= m_all && t.CountScore < g_all).Count();
                    int l_count = classsScore.Where(t => t.CountScore >= l_all && t.CountScore < m_all).Count();
                    int e_count = classsScore.Where(t => t.CountScore < l_all).Count();
                    sb_Body.Append("<td>" + g_count + "</td>");
                    sb_Body.Append("<td>" + Math.Round((decimal)g_count / classsScore.Count * 100, 2) + "%</td>");
                    sb_Body.Append("<td>" + m_count + "</td>");
                    sb_Body.Append("<td>" + Math.Round((decimal)m_count / classsScore.Count * 100, 2) + "%</td>");
                    sb_Body.Append("<td>" + l_count + "</td>");
                    sb_Body.Append("<td>" + Math.Round((decimal)l_count / classsScore.Count * 100, 2) + "%</td>");
                    sb_Body.Append("<td>" + e_count + "</td>");
                    sb_Body.Append("<td>" + Math.Round((decimal)e_count / classsScore.Count * 100, 2) + "%</td>");
                    sb_Body.Append("</tr>");
                }
            }

            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本校</td>");
            decimal schoolNum = scoreInfos.GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + schoolNum + "</td>");
            var schoolScore = scoreInfos.GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
            int g_schoolcount = schoolScore.Where(t => t.CountScore >= g_all).Count();
            int m_schoolcount = schoolScore.Where(t => t.CountScore >= m_all && t.CountScore < g_all).Count();
            int l_schoolcount = schoolScore.Where(t => t.CountScore >= l_all && t.CountScore < m_all).Count();
            int e_schoolcount = schoolScore.Where(t => t.CountScore < l_all).Count();
            sb_Body.Append("<td>" + g_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)g_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + m_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)m_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + l_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)l_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + e_schoolcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)e_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");

            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本分组</td>");
            decimal areaNum = AllScoreInfos.Where(t => t.AreaId == AreaId).GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + areaNum + "</td>");
            var areaScore = AllScoreInfos.Where(t => t.AreaId == AreaId).GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
            int g_areacount = areaScore.Where(t => t.CountScore >= g_all).Count();
            int m_areacount = areaScore.Where(t => t.CountScore >= m_all && t.CountScore < g_all).Count();
            int l_areacount = areaScore.Where(t => t.CountScore >= l_all && t.CountScore < m_all).Count();
            int e_areacount = areaScore.Where(t => t.CountScore < l_all).Count();
            sb_Body.Append("<td>" + g_areacount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)g_areacount / areaScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + m_areacount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)m_areacount / areaScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + l_areacount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)l_areacount / areaScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + e_areacount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)e_areacount / areaScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");

            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本分组</td>");
            decimal allNum = AllScoreInfos.GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + allNum + "</td>");
            var allScore = AllScoreInfos.GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
            int g_allcount = allScore.Where(t => t.CountScore >= g_all).Count();
            int m_allcount = allScore.Where(t => t.CountScore >= m_all && t.CountScore < g_all).Count();
            int l_allcount = allScore.Where(t => t.CountScore >= l_all && t.CountScore < m_all).Count();
            int e_allcount = allScore.Where(t => t.CountScore < l_all).Count();
            sb_Body.Append("<td>" + g_allcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)g_allcount / allScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + m_allcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)m_allcount / allScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + l_allcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)l_allcount / allScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + e_allcount + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)e_allcount / allScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");

            return sb_Body.ToString();
        }

        public static string ChartBody11()
        {
            StringBuilder sb_Body = new StringBuilder();
            var fourScore = AllScoreInfos.GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).OrderByDescending(t => t.CountScore).ToList();
            decimal a = fourScore[Convert.ToInt32(fourScore.Count * 0.2)].CountScore;
            decimal b = fourScore[Convert.ToInt32(fourScore.Count * 0.4)].CountScore;
            decimal c = fourScore[Convert.ToInt32(fourScore.Count * 0.6)].CountScore;
            decimal d = fourScore[Convert.ToInt32(fourScore.Count * 0.8)].CountScore;


            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本校</td>");
            decimal school = AllScoreInfos.Where(t => t.SchoolId == SchoolId).Sum(t => t.CountScore);
            decimal schoolNum = AllScoreInfos.Where(t => t.SchoolId == SchoolId).GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + Math.Round(school / schoolNum, 2) + "</td>");
            sb_Body.Append("<td>" + Math.Round(school / (ExamPaperInfos.Sum(t => t.Score.Value) * schoolNum) * 100, 2) + "%</td>");
            var schoolScore = AllScoreInfos.Where(t => t.SchoolId == SchoolId).GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
            int a_schoolcount = schoolScore.Where(t => t.CountScore >= a).Count();
            int b_schoolcount = schoolScore.Where(t => t.CountScore >= b).Count();
            int c_schoolcount = schoolScore.Where(t => t.CountScore >= c).Count();
            int d_schoolcount = schoolScore.Where(t => t.CountScore >= d).Count();
            sb_Body.Append("<td>" + Math.Round((decimal)a_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)b_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)c_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)d_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");

            var query = AllScoreInfos.GroupBy(t => t.AreaId).Select(m => new { areaId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
            foreach (var q in query)
            {
                AreaInfo areaInfo = Area.GetSingleInfo(q.areaId);
                int studentNum = AllScoreInfos.Where(t => t.AreaId == q.areaId).GroupBy(t => t.StudentId).Count();
                sb_Body.Append("<tr>");
                sb_Body.Append("<td>" + areaInfo.Name + "</td>");
                sb_Body.Append("<td>" + Math.Round(q.CountScore / studentNum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(q.CountScore / (ExamPaperInfos.Sum(t => t.Score.Value) * studentNum) * 100, 2) + "%</td>");

                var areaScore = AllScoreInfos.Where(t => t.AreaId == q.areaId).GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).OrderByDescending(t => t.CountScore).ToList();
                int a_count = areaScore.Where(t => t.CountScore >= a).Count();
                int b_count = areaScore.Where(t => t.CountScore >= b).Count();
                int c_count = areaScore.Where(t => t.CountScore >= c).Count();
                int d_count = areaScore.Where(t => t.CountScore >= d).Count();
                sb_Body.Append("<td>" + Math.Round((decimal)a_count / areaScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)b_count / areaScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)c_count / areaScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)d_count / areaScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("</tr>");
            }
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>海淀区</td>");
            decimal allScore = fourScore.Sum(t => t.CountScore);
            sb_Body.Append("<td>" + Math.Round(allScore / fourScore.Count, 2) + "</td>");
            sb_Body.Append("<td>" + Math.Round(allScore / (ExamPaperInfos.Sum(t => t.Score.Value) * fourScore.Count) * 100, 2) + "%</td>");
            int a_allcount = fourScore.Where(m => m.CountScore >= a).Count();
            int b_allcount = fourScore.Where(m => m.CountScore >= b).Count();
            int c_allcount = fourScore.Where(m => m.CountScore >= c).Count();
            int d_allcount = fourScore.Where(m => m.CountScore >= d).Count();
            sb_Body.Append("<td>" + Math.Round((decimal)a_allcount / fourScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)b_allcount / fourScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)c_allcount / fourScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)d_allcount / fourScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");
            return sb_Body.ToString();
        }

        public static string ChartBody12()
        {
            StringBuilder sb_Body = new StringBuilder();
            decimal g_all = Convert.ToDecimal(ExamPaperInfos.Sum(t => t.Score.Value) * 0.85);
            decimal m_all = Convert.ToDecimal(ExamPaperInfos.Sum(t => t.Score.Value) * 0.75);
            decimal l_all = Convert.ToDecimal(ExamPaperInfos.Sum(t => t.Score.Value) * 0.6);

            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本校</td>");
            decimal school = AllScoreInfos.Where(t => t.SchoolId == SchoolId).Sum(t => t.CountScore);
            decimal schoolNum = AllScoreInfos.Where(t => t.SchoolId == SchoolId).GroupBy(t => t.StudentId).Count();
            sb_Body.Append("<td>" + Math.Round(school / schoolNum, 2) + "</td>");
            sb_Body.Append("<td>" + Math.Round(school / (ExamPaperInfos.Sum(t => t.Score.Value) * schoolNum) * 100, 2) + "%</td>");
            var schoolScore = AllScoreInfos.Where(t => t.SchoolId == SchoolId).GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
            int a_schoolcount = schoolScore.Where(t => t.CountScore >= g_all).Count();
            int b_schoolcount = schoolScore.Where(t => t.CountScore >= m_all && t.CountScore < g_all).Count();
            int c_schoolcount = schoolScore.Where(t => t.CountScore >= l_all && t.CountScore < m_all).Count();
            int d_schoolcount = schoolScore.Where(t => t.CountScore < l_all).Count();
            sb_Body.Append("<td>" + Math.Round((decimal)a_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)b_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)c_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)d_schoolcount / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");

            var query = AllScoreInfos.GroupBy(t => t.AreaId).Select(m => new { areaId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
            foreach (var q in query)
            {
                AreaInfo areaInfo = Area.GetSingleInfo(q.areaId);
                int studentNum = AllScoreInfos.Where(t => t.AreaId == q.areaId).GroupBy(t => t.StudentId).Count();
                sb_Body.Append("<tr>");
                sb_Body.Append("<td>" + areaInfo.Name + "</td>");
                sb_Body.Append("<td>" + Math.Round(q.CountScore / studentNum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(q.CountScore / (ExamPaperInfos.Sum(t => t.Score.Value) * studentNum) * 100, 2) + "%</td>");

                var areaScore = AllScoreInfos.Where(t => t.AreaId == q.areaId).GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).OrderByDescending(t => t.CountScore).ToList();
                int a_count = areaScore.Where(t => t.CountScore >= g_all).Count();
                int b_count = areaScore.Where(t => t.CountScore >= m_all && t.CountScore < g_all).Count();
                int c_count = areaScore.Where(t => t.CountScore >= l_all && t.CountScore < m_all).Count();
                int d_count = areaScore.Where(t => t.CountScore < l_all).Count();
                sb_Body.Append("<td>" + Math.Round((decimal)a_count / areaScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)b_count / areaScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)c_count / areaScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)d_count / areaScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("</tr>");
            }
            var fourScore = AllScoreInfos.GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).OrderByDescending(t => t.CountScore).ToList();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>海淀区</td>");
            decimal allScore = fourScore.Sum(t => t.CountScore);
            sb_Body.Append("<td>" + Math.Round(allScore / fourScore.Count, 2) + "</td>");
            sb_Body.Append("<td>" + Math.Round(allScore / (ExamPaperInfos.Sum(t => t.Score.Value) * fourScore.Count) * 100, 2) + "%</td>");
            int a_allcount = fourScore.Where(m => m.CountScore >= g_all).Count();
            int b_allcount = fourScore.Where(m => m.CountScore >= m_all && m.CountScore < g_all).Count();
            int c_allcount = fourScore.Where(m => m.CountScore >= l_all && m.CountScore < m_all).Count();
            int d_allcount = fourScore.Where(m => m.CountScore < l_all).Count();
            sb_Body.Append("<td>" + Math.Round((decimal)a_allcount / fourScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)b_allcount / fourScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)c_allcount / fourScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)d_allcount / fourScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");
            return sb_Body.ToString();
        }

        public static string ChartBody13()
        {
            StringBuilder sb_Body = new StringBuilder();
            decimal g_all = Convert.ToDecimal(ExamPaperInfos.Sum(t => t.Score.Value) * 0.85);
            var query = AllScoreInfos.Where(t => t.SchoolId == SchoolId).GroupBy(t => t.StudentId).Select(m => new { StudentId = m.Key, CountScore = m.Sum(t => t.CountScore) }).ToList();
            int i = 1;
            foreach (var q in query.Where(t => t.CountScore >= g_all).OrderByDescending(t => t.CountScore))
            {
                StudentInfo studentInfo = Student.GetSingleInfo(q.StudentId);
                TClassInfo classInfo = TClass.GetSingleInfo(studentInfo.ClassId);
                sb_Body.Append("<tr>");
                sb_Body.Append("<td>" + i + "</td>");
                sb_Body.Append("<td>" + studentInfo.Name + "</td>");
                sb_Body.Append("<td>" + classInfo.Name + "</td>");
                sb_Body.Append("<td>" + q.CountScore + "</td>");
                foreach (ExamPaperInfo exampaperInfo in ExamPaperInfos)
                {
                    decimal score = AllScoreInfos.Where(t => t.StudentId == studentInfo.Id && t.SubjectId == exampaperInfo.Subject.Value && t.AreaId == AreaId && t.SchoolId == SchoolId && t.ClassId == classInfo.Id).Select(t => t.CountScore).First();
                    sb_Body.Append("<td>" + score + "</td>");
                }
                i++;
            }
            return sb_Body.ToString();
        }

        public static string ChartBody14()
        {
            StringBuilder sb_Body = new StringBuilder();

            IList<StudentScoreExtendInfo> schoolScore = AllScoreInfos.Where(t => t.SchoolId == SchoolId && t.SubjectId == examPaperInfo.Subject.Value).ToList();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本校</td>");
            sb_Body.Append("<td>" + schoolScore.Count + "</td>");
            sb_Body.Append("<td>" + Math.Round(schoolScore.Sum(t => t.CountScore) / schoolScore.Count, 2) + "</td>");
            sb_Body.Append("<td>" + schoolScore.Max(t => t.CountScore) + "</td>");
            sb_Body.Append("<td>" + schoolScore.Min(t => t.CountScore) + "</td>");
            sb_Body.Append("</tr>");

            IList<StudentScoreExtendInfo> areaScore = AllScoreInfos.Where(t => t.AreaId == AreaId && t.SubjectId == examPaperInfo.Subject.Value).ToList();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本分组</td>");
            sb_Body.Append("<td>" + areaScore.Count + "</td>");
            sb_Body.Append("<td>" + Math.Round(areaScore.Sum(t => t.CountScore) / areaScore.Count, 2) + "</td>");
            sb_Body.Append("<td>" + areaScore.Max(t => t.CountScore) + "</td>");
            sb_Body.Append("<td>" + areaScore.Min(t => t.CountScore) + "</td>");
            sb_Body.Append("</tr>");

            IList<StudentScoreExtendInfo> allScore = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).ToList();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>海淀区</td>");
            sb_Body.Append("<td>" + allScore.Count + "</td>");
            sb_Body.Append("<td>" + Math.Round(allScore.Sum(t => t.CountScore) / allScore.Count, 2) + "</td>");
            sb_Body.Append("<td>" + allScore.Max(t => t.CountScore) + "</td>");
            sb_Body.Append("<td>" + allScore.Min(t => t.CountScore) + "</td>");
            sb_Body.Append("</tr>");

            return sb_Body.ToString();
        }

        public static string ChartBody15()
        {
            StringBuilder sb_Body = new StringBuilder();

            IList<StudentScoreExtendInfo> fourScore = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).OrderByDescending(t => t.CountScore).ToList();
            decimal a = fourScore[Convert.ToInt32(fourScore.Count * 0.2)].CountScore;
            decimal b = fourScore[Convert.ToInt32(fourScore.Count * 0.4)].CountScore;
            decimal c = fourScore[Convert.ToInt32(fourScore.Count * 0.6)].CountScore;
            decimal d = fourScore[Convert.ToInt32(fourScore.Count * 0.8)].CountScore;

            IList<StudentScoreExtendInfo> schoolScore = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value && t.SchoolId == SchoolId).ToList();
            int a_school = schoolScore.Where(t => t.CountScore >= a).Count();
            int b_school = schoolScore.Where(t => t.CountScore >= b).Count();
            int c_school = schoolScore.Where(t => t.CountScore >= c).Count();
            int d_school = schoolScore.Where(t => t.CountScore >= d).Count();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本校</td>");
            sb_Body.Append("<td>" + a_school + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)a_school / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + b_school + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)b_school / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + c_school + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)c_school / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + d_school + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)d_school / schoolScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");

            IList<StudentScoreExtendInfo> areaScore = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value && t.AreaId == AreaId).ToList();
            int a_area = areaScore.Where(t => t.CountScore >= a).Count();
            int b_area = areaScore.Where(t => t.CountScore >= b).Count();
            int c_area = areaScore.Where(t => t.CountScore >= c).Count();
            int d_area = areaScore.Where(t => t.CountScore >= d).Count();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本分组</td>");
            sb_Body.Append("<td>" + a_area + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)a_area / areaScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + b_area + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)b_area / areaScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + c_area + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)c_area / areaScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + d_area + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)d_area / areaScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");

            IList<StudentScoreExtendInfo> allScore = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).ToList();
            int a_all = allScore.Where(t => t.CountScore >= a).Count();
            int b_all = allScore.Where(t => t.CountScore >= b).Count();
            int c_all = allScore.Where(t => t.CountScore >= c).Count();
            int d_all = allScore.Where(t => t.CountScore >= d).Count();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>海淀区</td>");
            sb_Body.Append("<td>" + a_all + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)a_all / allScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + b_all + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)b_all / allScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + c_all + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)c_all / allScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("<td>" + d_all + "</td>");
            sb_Body.Append("<td>" + Math.Round((decimal)d_all / allScore.Count * 100, 2) + "%</td>");
            sb_Body.Append("</tr>");
            return sb_Body.ToString();
        }

        public static string ChartBody16()
        {
            StringBuilder sb_Body = new StringBuilder();
            IList<StudentScoreExtendInfo> schoolScore = AllScoreInfos.Where(t => t.SchoolId == SchoolId && t.SubjectId == examPaperInfo.Subject.Value).ToList();

            IList<StudentScoreExtendInfo> areaScore = AllScoreInfos.Where(t => t.AreaId == AreaId && t.SubjectId == examPaperInfo.Subject.Value).ToList();

            IList<StudentScoreExtendInfo> allScore = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).ToList();
            int i = examPaperInfo.Score.Value;
            while (i > 0)
            {
                sb_Body.Append("<tr>");
                sb_Body.Append("<td>" + i + "~" + (i - 5) + "</td>");
                sb_Body.Append("<td>" + schoolScore.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + schoolScore.Where(t => t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)schoolScore.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() / schoolScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)schoolScore.Where(t => t.CountScore >= i - 5).Count() / schoolScore.Count * 100, 2) + "%</td>");

                sb_Body.Append("<td>" + areaScore.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + areaScore.Where(t => t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)areaScore.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() / areaScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)areaScore.Where(t => t.CountScore >= i - 5).Count() / areaScore.Count * 100, 2) + "%</td>");

                sb_Body.Append("<td>" + allScore.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + allScore.Where(t => t.CountScore >= i - 5).Count() + "</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)allScore.Where(t => t.CountScore < i && t.CountScore >= i - 5).Count() / allScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("<td>" + Math.Round((decimal)allScore.Where(t => t.CountScore >= i - 5).Count() / allScore.Count * 100, 2) + "%</td>");
                sb_Body.Append("<tr>");
                i = i - 5;
            }
            return sb_Body.ToString();
        }
        //OK
        public static string ChartBody17()
        {
            StringBuilder sb_Body = new StringBuilder();
            decimal g = Convert.ToDecimal(examPaperInfo.Score.Value * 0.85);
            decimal m = Convert.ToDecimal(examPaperInfo.Score.Value * 0.75);
            decimal l = Convert.ToDecimal(examPaperInfo.Score.Value * 0.6);
            IList<StudentScoreExtendInfo> schoolScore = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value && t.SchoolId == SchoolId).OrderByDescending(t => t.CountScore).ToList();
            int g_schoolnum = schoolScore.Where(t => t.CountScore >= g).Count();
            int m_schoolnum = schoolScore.Where(t => t.CountScore >= m && t.CountScore < g).Count();
            int l_schoolnum = schoolScore.Where(t => t.CountScore >= l && t.CountScore < m).Count();
            int e_schoolnum = schoolScore.Where(t => t.CountScore < l).Count();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本校</td>");
            sb_Body.Append("<td>" + schoolScore.Count + "</td>");
            if (schoolScore.Count == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(schoolScore.Sum(t => t.CountScore) / schoolScore.Count, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(schoolScore.Sum(t => t.CountScore) / (examPaperInfo.Score.Value * schoolScore.Count) * 100, 2) + "%</td>");
            }
            if (g_schoolnum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(schoolScore.Where(t => t.CountScore >= g).Sum(t => t.CountScore) / g_schoolnum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(schoolScore.Where(t => t.CountScore >= g).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * g_schoolnum) * 100, 2) + "%</td>");
            }
            if (m_schoolnum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(schoolScore.Where(t => t.CountScore >= m && t.CountScore < g).Sum(t => t.CountScore) / m_schoolnum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(schoolScore.Where(t => t.CountScore >= m && t.CountScore < g).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * m_schoolnum) * 100, 2) + "%</td>");
            }
            if (l_schoolnum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(schoolScore.Where(t => t.CountScore >= l && t.CountScore < m).Sum(t => t.CountScore) / l_schoolnum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(schoolScore.Where(t => t.CountScore >= l && t.CountScore < m).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * l_schoolnum) * 100, 2) + "%</td>");

            }
            if (e_schoolnum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(schoolScore.Where(t => t.CountScore < l).Sum(t => t.CountScore) / e_schoolnum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(schoolScore.Where(t => t.CountScore < l).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * e_schoolnum) * 100, 2) + "%</td>");
            }
            sb_Body.Append("</tr>");

            IList<StudentScoreExtendInfo> areaScore = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value && t.AreaId == AreaId).OrderByDescending(t => t.CountScore).ToList();
            int g_areanum = areaScore.Where(t => t.CountScore >= g).Count();
            int m_areanum = areaScore.Where(t => t.CountScore >= m && t.CountScore < g).Count();
            int l_areanum = areaScore.Where(t => t.CountScore >= l && t.CountScore < m).Count();
            int e_areanum = areaScore.Where(t => t.CountScore < l).Count();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>本分组</td>");
            sb_Body.Append("<td>" + areaScore.Count + "</td>");
            if (areaScore.Count == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(areaScore.Sum(t => t.CountScore) / areaScore.Count, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(areaScore.Sum(t => t.CountScore) / (examPaperInfo.Score.Value * areaScore.Count) * 100, 2) + "%</td>");
            }
            if (g_areanum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(areaScore.Where(t => t.CountScore >= g).Sum(t => t.CountScore) / g_areanum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(areaScore.Where(t => t.CountScore >= g).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * g_areanum) * 100, 2) + "%</td>");
            }
            if (m_areanum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(areaScore.Where(t => t.CountScore >= m && t.CountScore < g).Sum(t => t.CountScore) / m_areanum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(areaScore.Where(t => t.CountScore >= m && t.CountScore < g).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * m_areanum) * 100, 2) + "%</td>");
            }
            if (l_areanum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(areaScore.Where(t => t.CountScore >= l && t.CountScore < m).Sum(t => t.CountScore) / l_areanum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(areaScore.Where(t => t.CountScore >= l && t.CountScore < m).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * l_areanum) * 100, 2) + "%</td>");
            }
            if (e_areanum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(areaScore.Where(t => t.CountScore < l).Sum(t => t.CountScore) / e_areanum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(areaScore.Where(t => t.CountScore < l).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * e_areanum) * 100, 2) + "%</td>");
            }
            sb_Body.Append("</tr>");

            IList<StudentScoreExtendInfo> allScore = AllScoreInfos.Where(t => t.SubjectId == examPaperInfo.Subject.Value).OrderByDescending(t => t.CountScore).ToList();
            int g_allnum = allScore.Where(t => t.CountScore >= g).Count();
            int m_allnum = allScore.Where(t => t.CountScore >= m && t.CountScore < g).Count();
            int l_allnum = allScore.Where(t => t.CountScore >= l && t.CountScore < m).Count();
            int e_allnum = allScore.Where(t => t.CountScore < l).Count();
            sb_Body.Append("<tr>");
            sb_Body.Append("<td>海淀区</td>");
            sb_Body.Append("<td>" + allScore.Count + "</td>");
            if (allScore.Count == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(allScore.Sum(t => t.CountScore) / allScore.Count, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(allScore.Sum(t => t.CountScore) / (examPaperInfo.Score.Value * allScore.Count) * 100, 2) + "%</td>");
            }
            if (g_allnum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(allScore.Where(t => t.CountScore >= g).Sum(t => t.CountScore) / g_allnum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(allScore.Where(t => t.CountScore >= g).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * g_allnum) * 100, 2) + "%</td>");
            }
            if (m_allnum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(allScore.Where(t => t.CountScore >= m && t.CountScore < g).Sum(t => t.CountScore) / m_allnum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(allScore.Where(t => t.CountScore >= m && t.CountScore < g).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * m_allnum) * 100, 2) + "%</td>");
            }
            if (l_allnum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(allScore.Where(t => t.CountScore >= l && t.CountScore < m).Sum(t => t.CountScore) / l_allnum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(allScore.Where(t => t.CountScore >= l && t.CountScore < m).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * l_allnum) * 100, 2) + "%</td>");
            }
            if (e_allnum == 0)
            {
                sb_Body.Append("<td>0</td>");
                sb_Body.Append("<td>0</td>");
            }
            else
            {
                sb_Body.Append("<td>" + Math.Round(allScore.Where(t => t.CountScore < l).Sum(t => t.CountScore) / e_allnum, 2) + "</td>");
                sb_Body.Append("<td>" + Math.Round(allScore.Where(t => t.CountScore < l).Sum(t => t.CountScore) / (examPaperInfo.Score.Value * e_allnum) * 100, 2) + "%</td>");
            }
            sb_Body.Append("</tr>");
            return sb_Body.ToString();
        }
        #endregion
    }
}
